import scrapy
from videoedu.items import VideoeduItem


class VideoSpider(scrapy.Spider):
    name = "video"
    allowed_domains = ["www.sp910.com"]
    start_urls = ["https://www.sp910.com/shipin/yinyue/gz/"]

    def parse(self, response):
        div=response.xpath("//div[@class='hitv_horizontal scroll-item hover-scale']")
        # print(div)
        for i in div:
            title = i.xpath(".//a/@title").extract_first()
            duration=i.xpath(".//div[@class='hitv_horizontal-duration']/p/text()").extract_first()
            video_img = i.xpath(".//img/@src").extract_first()
            # print(title,duration,video_img)
            video = VideoeduItem(Title=title,Duration=duration,Video_img=video_img)
            yield video
        pass
